<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>居中测试</title>
    <style>

        *{
            margin: 0;
            padding: 0;
        }

        .main{
            background-color: lightgreen;
        }

        .center{
            background-color: #0aa1ed;
            width: 1000px;
            margin: 0 auto;
        }

        .card {
            width: 200px;
            height: 300px;
            background-color: pink;
            border: 3px solid #000;
            text-align: center;
            line-height: 300px;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="center">
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
        <div class="card">我是内容</div>
    </div>
</div>
</body>
</html>